Test Series - Data Structure

Test Number 98/115

Q: Which of the following is used in hash tables to determine the index of any input record?
A. hash function
B. hash linked list
C. hash tree
D. hash chaining
Solution: Hash table is an example of a data structure that is built for fast access of elements. Hash functions are used to determine the index of any input record in a hash table.
Q: What is the advantage of a hash table as a data structure?
A. faster access of data
B. easy to implement
C. very efficient for less number of entries
D. exhibit good locality of reference
Solution: Hash table is a data structure that has an advantage that it allows fast access of elements. Hash functions are used to determine the index of any input record in a hash table.
Q: What is the use of a hash function?
A. to calculate and return the index of corresponding data
B. to store data
C. to erase data
D. to change data
Solution: Hash function calculates and returns the index for corresponding data. This data is then mapped in a hash table.
Q: What is the time complexity of insert function in a hash table using a doubly linked list?
A. O(1)
B. O(n)
C. O(log n)
D. O(n log n)
Solution: Time complexity of insert function in a hash table is O(1). Condition is that the number of collisions should be low.
Q: What is the time complexity of search function in a hash table using a doubly linked list?
A. O(1)
B. O(n)
C. O(log n)
D. O(n log n)
Solution: Time complexity of search function in a hash table is O(1). Condition is that the number of collisions should be low.
Q: What is the time complexity of delete function in the hash table using a doubly linked list?
A. O(1)
B. O(n)
C. O(log n)
D. O(n log n)
Solution: Time complexity of delete function in a hash table is O(1). Condition is that the hash function should be such that the number of collisions should be low.
Q: Hashing can be used to encrypt and decrypt digital signatures.
A. true
B. false
C. none
D. ..
Solution: Hashing is also used in encryption algorithms. It is used for encryption and decryption of digital signatures.
Q: What is the advantage of using a doubly linked list for chaining over singly linked list?
A. it takes less memory
B. it is easy to implement
C. it makes the process of insertion and deletion faster
D. it causes less collisions
Solution: Using a doubly linked list reduces time complexity significantly. Though it uses more memory to store the extra pointer.
Q: Which of the following technique stores data in the hash table itself in case of a collision?
A. Open addressing
B. Chaining using linked list
C. Chaining using doubly linked list
D. Chaining using binary tree
Solution: Open addressing is used to store data in the table itself in case of a collision. Whereas chaining stores data in a separate entity.
Q: Which of the following technique stores data in a separate entity in case of a collision?
A. Open addressing
B. Chaining using doubly linked list
C. Linear probing
D. Double hashing
Solution: Chaining using doubly linked list is used to store data in a separate entity (doubly linked list in this case) in case of a collision. Whereas open addressing stores it in the table itself.

You Have Score    /10